package org.example.threadlocaltest.demos.configure;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class MyWebConfig implements WebMvcConfigurer {

    //注册 MyInterceptor 拦截器
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 只拦截 /basic/** 路径下的请求
        registry.addInterceptor(new MyInterceptor()).addPathPatterns("/basic/**");
    }

}
